package day12;

import java.util.Scanner;

public class demo3 {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        char[]str=in.next().toCharArray();
        long s=0,h=0,y=0;
        for (int i = 0; i < str.length ; i++) {
            if(str[i]=='s'){
                s++;
            } else if (str[i]=='h') {
                h+=s;
            } else if (str[i]=='y') {
                y+=h;
            }
        }
        System.out.println(y);
    }
}
